<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" import="com.tz.hospital.entity.*, java.util.List "%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<!-- 引入 layui.css -->
<link rel="stylesheet" href="/hospital_system/layui-v2.6.8/layui/css/layui.css"/>
<!-- 引入 layui.js -->
<script src="/hospital_system/layui-v2.6.8/layui/layui.js"></script>
</head>
<body>
<%List<staff_bm> l=(List)request.getAttribute("data"); %>

 <div style="width:400px;margin:0 auto;heigth:100vh; display:flex;">
 
    <div class="layui-form"  >
    <div class="layui-form-item">
    <label class="layui-form-label">员工姓名</label>
    <div class="layui-input-block">
    
      <input type="text" name="ygname" required  lay-verify="required" 
       value="<%=l.get(0).getYgname()%>" style="pointer-events: none;" autocomplete="off" class="layui-input">
    </div>
  
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">部门</label>
    <div class="layui-input-block">
      <input type="text" name="bmid" required  lay-verify="required" style="pointer-events: none;" value="<%=l.get(0).getBmid()%>" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">职务</label>
    <div class="layui-input-block">
      <input type="text" name="ygpost" required  lay-verify="required" style="pointer-events: none;" value="<%=l.get(0).getYgpost()%>"  autocomplete="off" class="layui-input">
    </div>
  </div>
  
  <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
  <legend>权限设置</legend>
</fieldset>
<div class="layui-btn-container">
  <button type="button" class="layui-btn layui-btn-sm" lay-demo="getChecked">获取选中节点数据</button>
  <button type="button" class="layui-btn layui-btn-sm" lay-demo="setChecked">勾选指定节点</button>
  <button type="button" class="layui-btn layui-btn-sm" lay-demo="reload">重载实例</button>
</div>
 
<div id="test12" class="demo-tree-more"></div>
  
  
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button  class="layui-btn" lay-demo="getChecked">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
      
    </div>
  </div>
</div>
</div>
 
<script>
layui.use(['tree', 'util'], function(){
	  var tree = layui.tree
	  ,layer = layui.layer
	  ,util = layui.util
	  
	  //模拟数据
	  ,data = [{
	    title: '后台'
	    ,id: 1
	    ,field: 'name1'
	    ,checked: true
	    ,spread: true
	    ,children: [{
	      title: '住院管理'
	      ,id: 2
	      ,field: 'name11'
	      
	      ,children: [{
	        title: '人员入住'
	        ,id: 21
	        ,field: '2rz'
	        
	      },{
	        title: '住院服务'
	        ,id: 22
	        ,field: '2zy'
	        
	      },{
	        title: '退房管理'
	        ,id: 23
	        ,field: '2gl'
	        
	      }]
	    },{
	      title: '药库管理'
	      ,id: 3
	      ,spread: true
	      ,children: [{
	        title: '药品入库'
	        ,id: 31
	        ,field: '3yk'
	       
	      },{
	        title: '消费记录'
	        ,id: 32
	        ,field: '3jl'
	      }]
	    },{
	      title: '系统管理'
	      ,id: 4
	      ,field: ''
	      ,children: [{
	        title: '菜单管理'
	        ,id: 41
	        ,field: '4cd'
	      },{
	        title: '单位设置'
	        ,id: 42
	        ,field: '4dw'
	      }]
	    }]
	  }]
	  
	//基本演示
	  tree.render({
	    elem: '#test12'
	    ,data: data
	    ,showCheckbox: true  //是否显示复选框
	    ,id: 'demoId1'
	    ,isJump: true //是否允许点击节点时弹出新窗口跳转
	    ,click: function(obj){
	      var data = obj.data;  //获取当前点击的节点数据
	      layer.msg('状态：'+ obj.state + '<br>节点数据：' + JSON.stringify(data));
	    }
	  });
	  //按钮事件
	  util.event('lay-demo', {
	    getChecked: function(othis){
	      var checkedData = tree.getChecked('demoId1'); //获取选中节点的数据
	      var name = document.getElementsByName("ygname");
	      layer.alert(JSON.stringify(checkedData), {shade:0});
	      console.log(checkedData);
	      
	     
	      location.href="/hospital_system/upstaffController?ygpower="+JSON.stringify(checkedData)+"&ygid="+<%=l.get(0).getYgid()%>; 
	    }
	    ,setChecked: function(){
	      tree.setChecked('demoId1', [12, 16]); //勾选指定节点
	    }
	    ,reload: function(){
	      //重载实例
	      tree.reload('demoId1', {
	        
	      });
	      
	    }
	  });
});
	
	  

</script>
  </body>
</html>